import {observable, action} from 'mobx'
import * as api from '../../utils/api'
import axios from '../../utils/http'

class setStoreInfo{
    @action
    //获取设置-商店设置-商店信息
    getSetStoreInfo(){
        return axios({
            method:'GET',
            url:api.POST_QUERY_SHOP_OPTIONS
        })
    }
    //获取设置-商店设置-省份
    getSetProvence(){
        return axios({
            method:'GET',
            url:api.GET_QUERY_PROVINCES
        })
    }
    //获取设置-商店设置-城市
    getSetCities(provinceId){
        return axios({
            method:'GET',
            url:api.GET_QUERY_CITYS,
            params:{
                provinceId
            }
        })
    }
    //提交设置-商店设置-表单
    getQuery(formData){
        return axios({
            method:'POST',
            url:api.POST_UPDATE_SHOP,
            data:formData
        })
    }
    //提交设置-商店设置-图片
    getPhotos(formData){
        return axios({
            method:'POST',
            url:api.POST_UPLOAD_PHOTOS,
            data:formData
        })
    }

    //基本设置
    getStoreBasicSet(){
        return axios({
            method:'GET',
            url:api.GET_QUERY_SHOP_MSG_OPTIONS
        })
    }
    updateStoreBasicSet(form){
        return axios({
            method:"POST",
            url:api.POST_UPDATE_SHOP_MSG_OPTIONS,
            data:form
        })
    }
    //显示设置
    getStoreShowSet(){
        return axios({
            method:'GET',
            url:api.GET_QUETY_SHOP_ACC_OPTIONS
        })
    }
    updateStoreShowSet(formData){
        return axios({
            method:'POST',
            url:api.POST_UPDATE_SHOP_ACC_OPTIONS,
            data:formData
        })
    }
    //购物流程
    getStoreShoppingProcess(){
        return axios({
            method:'GET',
            url:api.GET_QUETY_PRO_SHOP_OPTIONS
        })
    }
    updateStoreShoppingProcess(formData){
        return axios({
            method:'POST',
            url:api.POST_UPDATE_PRO_SHOP_OPTIONS,
            data:formData
        })
    }
    //接口设置
    getStoreInter(){
        return axios({
            method:'GET',
            url:api.GET_QUERY_STORE_INTER
        })
    }
    updateStoreInter(formData){
        return axios({
            method:'POST',
            url:api.POST_UPDATE_STORE_INTER,
            data:formData
        })
    }
    //商品显示设置
    getGoodsShowSet(){
        return axios({
            method:'GET',
            url:api.GET_GOODS_SHOW_SET
        })
    }
    updateGoodsShowSet(formData){
        return axios({
            method:'POST',
            url:api.POST_GOODS_SHOW_SET,
            data:formData
        })
    }
    //分享设置
    getShareSet(){
        return axios({
            method:'GET',
            url:api.GET_SHARE_SET
        })
    }
    updateShareSet(formData){
        return axios({
            method:'POST',
            url:api.POST_SHARE_SET,
            data:formData
        })
    }
    
    /* 菜单管理 */
    //查询菜单
    getMenuInfo(){
        return axios({
            method:'POST',
            url:api.POST_QUERY_MENU
        })
    }
    //添加菜单
    addMenuInfo(formData){
        return axios({
            method:'POST',
            url:api.POST_ADD_MENU,
            data:formData
        })
    }
    //是否启用
    isUseMenu(formData){
        return axios({
            url:api.GET_IS_USE,
            method:'GET',
            params:formData
        })
    }
    modifyMenuInfo(formData){
        return axios({
            url:api.POST_UPDATE_MENU,
            method:'POST',
            data:formData
        })
    }

    /* 支付方式设置 */
    addPaySet(formData){
        return axios({
            url:api.POST_ADD_PAY,
            method:'POST',
            data:formData
        })
    }
    isUsePay(formData){
        return axios({
            url:api.GET_IS_USE_PAY,
            method:"GET",
            params:formData
        })
    }
    getPaySet(){
        return axios({
            url:api.GET_PAY,
            method:'GET'
        })
    }
    modifyPaySet(formData){
        return axios({
            url:api.GET_MODIFY_PAY,
            method:'GET',
            params:formData
        })
    }
}

export default setStoreInfo